#!/bin/bash
source "${LMD_BASE_INSTALL_SCRIPT_DIR}/global/alias.sh"
source "${LMD_BASE_INSTALL_SCRIPT_DIR}/global/conda_and_pip_settings.sh"

conda config --set show_channel_urls yes


APP_TARGET_DIR_NAME="NotaGen"

CONDA_PREFIX="../venv"

export CURRENT_APP_PATH="${LMD_APPS_DIR}/${APP_TARGET_DIR_NAME}"
echo 'App Dir: '${CURRENT_APP_PATH}

cd "$CURRENT_APP_PATH"

if [ -z "$HF_ENDPOINT" ] && [ -n "$HF_MIRROR" ]; then
    export HF_ENDPOINT="$HF_MIRROR"
fi

export GRADIO_TEMP_DIR="$CURRENT_APP_PATH/temp"

echo "use ./venv to start app."

cd ./gradio/
grep -vE 'server_port=7861' demo.py > demo-temp.py

conda run -p $CONDA_PREFIX --no-capture-output python demo-temp.py


